<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<div class="r_location">
	<i class="r_txtico"></i> 微信配置管理 &gt; 微信生成带参数二维码
</div>
<form id="add_form" action="cms/wechatqrcode/createQrCode"   method="post">
	<ul class="all_list">
		<li>
			<span class="all_title">渠道：</span>
			<span>
			     <input type="text" name="channel" id="channel" class="span8" style="width: 155px;" class="ui_input" validator='{"label":"渠道"}' />
			</span>
		</li>
		<li>
			<span class="all_title"></span>
			<span><div id="html_image" class="name" style="color: red;"></div></span>
		</li>
		<li>
			<span class="all_title"></span>
			<span> 
				<input type="button" id="query" value="生成二维码" class="btn_blue m-r15 submitBtn">
			</span>
		</li>
	</ul>
</form>
<script type="text/javascript">
	$(function(){
		      
		function showDialog(url, options) {
			myDialog = art.dialog(options);// 初始化一个带有loading图标的空对话框
			$.post(url, options.param, function(data) {
				myDialog.content(data);
			});
		}
		$("#add_form").validator({},{
			callback:function(result){
			var channel = $("#channel").val();	
			 $("#add_form").ajaxSubmit(function(data){
					 if (data.success == 'succeed') {
						 $("#html_image").html("");
		       				var html = "";
	       					html = "<img src='"+data.message+"' width='200' height='200'><br/>";
	       					html = html + "<span style='font-size:18px;'>生成的"+channel+"二维码成功</span><br/>";
	       					html = html + '<a href="'+data.message+'" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载二维码,只支持IE内核浏览器，其他浏览器可点击鼠标右键选择图片另存为选项</a>'
	       					$("#html_image").html(html);
					} else {
						art.dialog({icon: 'error',content: json.message,lock:true});
					} 
				}); 
				
			}
		});
	});
	
	
	
	
	
	 function savepic() { 
     	if (document.all.a1 == null) { 
     		objIframe = document.createElement("IFRAME"); 
     		document.body.insertBefore(objIframe); 
     		objIframe.outerHTML = "<iframe name=a1 style='width:0px;hieght:0px;display:none;' src=" + imageName.href + "></iframe>"; 
     		re = setTimeout("savepic()", 1) 
     	} else { 
     		clearTimeout(re) 
     		pic = window.open(imageName.href, "a1") 
     		pic.document.execCommand("SaveAs") 
     		document.all.a1.removeNode(true) 
     	} 
     } 
</script>